//深拷贝
function isObject(target) {
  if (typeof target === 'object') {
    return true
  }
  return false
}

function isArray(target) {
  if (Array.isArray(target)) {
    return true
  }
  return false
}
// 循环递归
function deepClone(target) {
  if (isObject(target)) {
    let cloneTarget = isArray(target) ? [] : {};
    for (const key in target) {
      cloneTarget[key] = deepClone(target[key]);
      console.log(cloneTarget,)
    }
    return cloneTarget;
  } else {
    return target;
  }
};
testObj = {
  num: 123,
  obj: {
    a: 1,
    b: 2,
    c: {
      qq: 123,
      ww: 4323
    }
  }
}


let newObj = deepClone(testObj)

// console.log('newObj', newObj);
